package com.zm.exam.springbootexam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zm.exam.springbootexam.entry.Exam;
import org.apache.ibatis.annotations.*;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zm
 * @since 2024-08-14
 */
public interface ExamMapper extends BaseMapper<Exam> {

    @Select("select * from exam where pid = #{pid} and uid = #{uid}")
    @Results(
            id = "rm1",
            value = {
                    @Result(column = "id",property = "id",id = true),
                    @Result(column = "id",property = "details",
                            many = @Many(select = "com.zm.exam.springbootexam.mapper.ExamDetailMapper.findByEid"))
            }
    )
    public Exam findById(@Param("pid") int pid, @Param("uid") int uid);

}
